package com.fst.dsi.lib.domain.entity;

import java.io.Serializable;
import javax.persistence.*;

import com.dnr.arch.kernel.model.AbstractValue;
import com.dnr.arch.kernel.model.Value;

import java.math.BigInteger;
import java.sql.Timestamp;
import java.sql.Date;
import java.util.List;


/**
 * The persistent class for the book database table.
 * 
 */
@Entity
@Table(name="book")
public class Book extends AbstractValue implements Serializable, Value {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="id_", unique=true, nullable=false)
	private String id;

	@Column(name="coverimage_", length=200)
	private String coverImage;

	@Column(name="creationdate_", nullable=false)
	private Timestamp creationDate;

	@Column(name="creatoruserid_", nullable=false)
	private BigInteger creatorUserId;

    @Lob()
	@Column(name="description_")
	private String description;

	@Column(name="isbn_", nullable=false, length=100)
	private String isbn;

	@Column(name="name_", nullable=false, length=100)
	private String name;

	@Column(name="nbpages_", nullable=false)
	private int nbPages;

	@Column(name="publishdate_", nullable=false)
	private Date publishDate;

	@Column(name="qrcode_")
	private int qrCode;

	@Column(name="qrcodeimage_", length=200)
	private String qrCodeImage;

	//bi-directional many-to-one association to Author
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="authorid_", nullable=false)
	private Author author;

	//bi-directional many-to-one association to Publisher
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="publisherid_", nullable=false)
	private Publisher publisher;

	
	//bi-directional many-to-one association to BookOperation
	@OneToMany(mappedBy="book")
	private List<BookOperation> bookOperation;
	
    public Book() {
    }

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCoverimage() {
		return this.coverImage;
	}

	public void setCoverimage(String coverimage) {
		this.coverImage = coverimage;
	}

	public Timestamp getCreationdate() {
		return this.creationDate;
	}

	public void setCreationdate(Timestamp creationdate) {
		this.creationDate = creationdate;
	}

	public BigInteger getCreatoruserid() {
		return this.creatorUserId;
	}

	public void setCreatoruserid(BigInteger creatoruserid) {
		this.creatorUserId = creatoruserid;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getIsbn() {
		return this.isbn;
	}

	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getNbpages() {
		return this.nbPages;
	}

	public void setNbpages(int nbpages) {
		this.nbPages = nbpages;
	}

	public Date getPusblishdate() {
		return this.publishDate;
	}

	public void setPusblishdate(Date pusblishdate) {
		this.publishDate = pusblishdate;
	}

	public int getQrcode() {
		return this.qrCode;
	}

	public void setQrcode(int qrcode) {
		this.qrCode = qrcode;
	}

	public String getQrcodeimage() {
		return this.qrCodeImage;
	}

	public void setQrcodeimage(String qrcodeimage) {
		this.qrCodeImage = qrcodeimage;
	}

	public Author getAuthor() {
		return this.author;
	}

	public void setAuthor(Author author) {
		this.author = author;
	}
	
	public Publisher getPublisher() {
		return this.publisher;
	}

	public void setPublisher(Publisher publisher) {
		this.publisher = publisher;
	}
	
	public List<BookOperation> getBookOperations() {
		return this.bookOperation;
	}
	
	public void setBooks(List<BookOperation> bookOperations) {
		this.bookOperation = bookOperations;
	}
	
}